const mongoose = require("mongoose");

mongoose.connect("mongodb://testdbadmin:123456@192.168.0.103:27017/testdb", {
  useNewUrlParser: true,
  useUnifiedTopology: true,
});

const User = mongoose.model(
  "user",
  {
    name: String,
    age: Number,
    email: String,
  },
  "user" /* 数据库名 * /
);

const felix = new User({
  name: "FelixChan",
  age: 20,
  email: "593048929@qq.com",
});

felix.save().then(() => {
  console.log("saved success");
});
